home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PsL Monthly 1993 December
/
PSL Monthly Shareware CD-ROM (December 1993).iso
/
prgmming
/
dos
/
c
/
bor_ti.exe
/
TI1035.ASC
< prev
next >
Wrap
Text File
|
1992-10-23
|
13KB
|
397 lines
PRODUCT : Borland C++ NUMBER : 1035
VERSION : 3.1
OS : ALL
DATE : October 23, 1992 PAGE : 1/6
TITLE : Using the Template version of the Class Library.
This document provides an overview of the various causes of the
the "Illegal Structure Operation..." error message generated when
using template classes, template functions, and/or BIDS.
Consider the classic function template max():
template <class T>
T max(T x, T y)
{
return (x > y) ? x : y ;
}
In order to pass in a user-defined type into this function, say
for instance class Foo{...};, Foo would need to have an
appropriate overloaded operator >() defined. If Foo did not have
such a function, passing in Foo objects would cause illegal or
undefined behavior because there is no comparison mechanism
for the compiler to use for Foo types. The same rules apply when
using the BIDS class library.
If you are using the template-based BIDS library, you'll see
advertised in the manuals that the template-based containers can
contain ANY type of object, default or user-defined, not just
those derived from the Object class (which is the requirement for
using the non-template base container classes). This is true,
although there are requirements for user-defined types which are
not clearly defined in the documentation. If these requirements
are not met, you will see compiler error messages such as "
Illegal structure operation in Base<T>::find<T> " or " Illegal
structure operation in Base<T>::findPred<T> ".
The following table illustrates what operators and functions need
to be provided for your type according to which BIDS container
you use. For example, in order to store a user-defined class in
BI_BagAsVector<foo>, foo must have operator==( ) defined
---------------------------------------------------------------- +
PRODUCT : Borland C++ NUMBER : 1035
VERSION : 3.1
OS : ALL
DATE : October 23, 1992 PAGE : 2/6
TITLE : Using the Template version of the Class Library.
| | | | | Constructor |
BIDS | == | != | < | isSortable |Default| Copy |
-----------------------|----|----|---|------------|-------|------|
BI_VectorImp | | | | | | |
-----------------------|----|----|---|------------|-------|------|
BI_CVectorImp | | | | | | |
-----------------------|----|----|---|------------|-------|------|
BI_SVectorImp | X | | X | | X | X |
-----------------------|----|----|---|------------|-------|------|
BI_IVectorImp | | | | | | |
-----------------------|----|----|---|------------|-------|------|
BI_ICVectorImp | X | | | X | | |
-----------------------|----|----|---|------------|-------|------|
BI_ISVectorImp | X | | X | X | | |
-----------------------|----|----|---|------------|-------|------|
| | | | | | |
-----------------------|----|----|---|------------|-------|------|
BI_ListImp | X | | | | | X |
-----------------------|----|----|---|------------|-------|------|
BI_SListImp | X | X | X | | X | X |
-----------------------|----|----|---|------------|-------|------|
BI_IListImp | X | | | | | |
-----------------------|----|----|---|------------|-------|------|
BI_ISListImp | X | X | X | | X | X |
-----------------------|----|----|---|------------|-------|------|
| | | | | | |
-----------------------|----|----|---|------------|-------|------|
BI_DoubleListImp | X | | | | | |
-----------------------|----|----|---|------------|-------|------|
BI_SDoubleListImp | X | X | X | | X | X |
-----------------------|----|----|---|------------|-------|------|
BI_IDoubleListImp | X | | | | | |
-----------------------|----|----|---|------------|-------|------|
BI_ISDoubleListImp | X | X | X | | X | X |
-----------------------|----|----|---|------------|-------|------|
| | | | | | |
-----------------------|----|----|---|------------|-------|------|
BI_ArrayAsVectorImp | | | | | X | X |
-----------------------|----|----|---|------------|-------|------|
BI_ArrayAsVector | X | | | | X | X |
-----------------------|----|----|---|------------|-------|------|
BI_SArrayAsVector | X | | X | X | X | X |
-----------------------|----|----|---|------------|-------|------|
PRODUCT : Borland C++ NUMBER : 1035
VERSION : 3.1
OS : ALL
DATE : October 23, 1992 PAGE : 3/6
TITLE : Using the Template version of the Class Library.
BI_IArrayAsVector | X | | | X | | |
-----------------------|----|----|---|------------|-------|------|
BI_ISArrayAsVector | X | | X | X | | |
-----------------------|----|----|---|------------|-------|------|
| | | | | | |
-----------------------|----|----|---|------------|-------|------|
BI_StackAsVectorImp | | | | | X | X |
-----------------------|----|----|---|------------|-------|------|
BI_StackAsVector | X | | | | X | X |
-----------------------|----|----|---|------------|-------|------|
BI_IStackAsVector | X | | | | X | |
-----------------------|----|----|---|------------|-------|------|
BI_StackAsListImp | | | | | X | X |
-----------------------|----|----|---|------------|-------|------|
BI_StackAsList | | | | | X | X |
-----------------------|----|----|---|------------|-------|------|
BI_IStackAsList | X | | | | X | |
-----------------------|----|----|---|------------|-------|------|
| | | | | | |
-----------------------|----|----|---|------------|-------|------|
BI_DequeAsVectorImp | | | | | X | X |
-----------------------|----|----|---|------------|-------|------|
BI_DequeAsVector | | | | | X | X |
-----------------------|----|----|---|------------|-------|------|
BI_IDequeAsVector | X | X | | | X | |
-----------------------|----|----|---|------------|-------|------|
BI_DequeAsDoubleListImp| | | | | X | X |
-----------------------|----|----|---|------------|-------|------|
BI_DequeAsDoubleList | X | X | | | X | X |
-----------------------|----|----|---|------------|-------|------|
BI_IDequeAsDoubleList | | | | | | |
-----------------------|----|----|---|------------|-------|------|
| | | | | | |
-----------------------|----|----|---|------------|-------|------|
BI_QueueAsVector | | | | | X | X |
-----------------------|----|----|---|------------|-------|------|
BI_IQueueAsVector | | | | |